//
//  HMSportMaskView.m
//  HMSport
//
//  Created by apple on 2017/4/27.
//  Copyright © 2017年 itheima. All rights reserved.
//

#import "HMSportMaskView.h"
#import "UIColor+CZAddition.h"

@interface HMSportMaskView ()

//快门视图
@property (nonatomic, weak) IBOutlet UIImageView *shutterView;

@end


@implementation HMSportMaskView


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
    [super drawRect:rect];
    
    //设置背景颜色 填充色
    
    //设置画笔
    [[UIColor cz_colorWithHex:0x25282e] setFill];
    //设置时路径
    UIBezierPath *path = [UIBezierPath bezierPathWithRect:rect];
    //填充
    [path fill];
    
    
    //绘制边线
    UIBezierPath *linePath = [UIBezierPath bezierPath];
    if (self.shutterView.frame.origin.x > 0) { //左侧视图
        //起点
        [linePath moveToPoint:CGPointMake(rect.size.width, 0)];
        //终点
        [linePath addLineToPoint:CGPointMake(rect.size.width, rect.size.height)];
    } else { //右侧视图
        
        //起点
        [linePath moveToPoint:CGPointMake(0, 0)];
        //终点
        [linePath addLineToPoint:CGPointMake(0, rect.size.height)];
    }
    //设置画笔
    [[UIColor cz_colorWithHex:0x1B1C1D] setStroke];
    //实现描边
    [linePath stroke];
    
    //清空指定区域的内容  裁切范围缩小一个点,避免多尺寸换算时尺寸裁切过大
//    CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectInset(self.shutterView.frame, 1, 1));
}


@end
